<template>
  <div id="jobProvided">
    <a-table
      :ref="tableRef"
      :columns="columns"
      :data="dataList"
      :pagination="{
        showTotal: true,
        pageSize: searchParams.pageSize,
        current: searchParams.current,
        total,
      }"
      @page-change="onPageChange"
    >
    </a-table>
  </div>
</template>

<script setup lang="ts">
import { onMounted, ref } from "vue";
import { StudentControllerService, TeacherPost } from "../../../generated";
import { useStore } from "vuex";
import message from "@arco-design/web-vue/es/message";

const tableRef = ref();
const dataList = ref([]);
const total = ref(0);
const store = useStore();
const searchParams = ref<TeacherPost>({
  address: "",
  jobInfo: "",
  phone: "",
  unitName: "",
});

const columns = [
  {
    title: "企业名称",
    dataIndex: "unitName",
  },
  {
    title: "岗位名称",
    dataIndex: "jobInfo",
  },
  {
    title: "地址",
    dataIndex: "address",
  },
  {
    title: "联系电话",
    dataIndex: "phone",
  },
];

onMounted(() => {
  loadData();
});

const loadData = async () => {
  const sid = sessionStorage.getItem("LoginUserId");
  const res = await StudentControllerService.selectJobProvidedUsingGet(sid);
  if (res.success === true) {
    dataList.value = res.data;
  } else {
    message.error("加载失败，" + res.message);
  }
};
</script>

<style scoped>
#jobProvided {
}
</style>
